from appium.webdriver.common.appiumby import AppiumBy

from appium_qiyeweixin.page_object.public.nav_menu import NavMenu


# 添加成员Page
class ManualInputPage(NavMenu):

    __USER_NAME = (AppiumBy.XPATH, "//*[contains(@text,'姓名')]/..//*[@text='必填']")
    __USER_PHONE = (AppiumBy.XPATH, "//*[contains(@text,'手机')]/..//*[@text='必填']")
    __USER_SAVE = (AppiumBy.XPATH, "//*[@text='保存']")

    # 填写添加人员信息
    def input_member_info(self, user_info):
        name = user_info.get('name')
        phone = user_info.get('phone')
        self.do_ele_send_keys(name, self.__USER_NAME)
        self.do_ele_send_keys(phone, self.__USER_PHONE)
        self.do_ele_click(self.__USER_SAVE)

        from appium_qiyeweixin.page_object.add_member_page import AddMemberPage
        return AddMemberPage(self.driver)